package cn.kevinproject.dingtalk_robot.msg;

import com.dingtalk.api.request.OapiRobotSendRequest;
import lombok.*;

/**
 * @author kevin lau
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
public class LinkTextMessage extends RichTextMessage{

    private String messageUrl;

    private String picUrl;

    public LinkTextMessage() {
        this.msgType = "link";
    }

    @Override
    public OapiRobotSendRequest buildRequest() {
        val request = super.buildRequest();
        val link =new  OapiRobotSendRequest.Link();
        link.setMessageUrl(getMessageUrl());
        link.setText(getText());
        link.setTitle(getTitle());
        link.setPicUrl(getPicUrl());
        request.setLink(link);
        return request;
    }
}
